﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using coffeeshop.coffeeDataSetTableAdapters;

namespace coffeeshop.Models
{
    public class CompoundProduct
    {
        private static CompoundProductTableAdapter _adapter = new CompoundProductTableAdapter();

        public int CompoundProductId { get; set; }
        public DateTime CreatedDate { get; set; }

        public CompoundProduct() { }

        public static CompoundProduct AddCompoundProduct()
        {
            try
            {
                coffeeDataSet.CompoundProductDataTable data = _adapter.AddCompoundProduct();
                CompoundProduct result = new CompoundProduct();
                result.CompoundProductId = (int)data.Rows[0]["CompoundProductId"];
                result.CreatedDate = (DateTime)data.Rows[0]["CreatedDate"];
                return result;
            }
            catch
            {
                return null;
            }
        }
    }
}
